﻿@model BlondeHeaven.ViewModels.User.RoleEditViewModel

@{
    ViewBag.Title = "编辑角色";
}

<h2>@ViewBag.Title</h2>

<form method="post">

    <div class="form-group row">
        <label asp-for="Id" class="col-sm-2"></label>
        <div class="col-sm-10">
            <input class="form-control" asp-for="Id" readonly>
            <span class="invalid" asp-validation-for="Id"></span>
        </div>
    </div>

    <div class="form-group row">
        <label asp-for="RoleName" class="col-sm-2"></label>
        <div class="col-sm-10">
            <input class="form-control" asp-for="RoleName">
            <span class="invalid" asp-validation-for="RoleName"></span>
        </div>
    </div>

    <div class="invalid" asp-validation-summary="ModelOnly">
    </div>

    <button type="submit" class="btn btn-primary">保存</button>
    <a asp-action="Index" class="btn btn-secondary">返回列表</a>
</form>

<hr />

<h3>角色的用户</h3>
<ul>
    @foreach (var user in Model.Users)
    {
        <li>@user</li>
    }
</ul>

<a asp-action="AddUserToRole" asp-route-roleId="@Model.Id" class="btn btn-primary">
    为角色添加用户
</a>
<a asp-action="DeleteUserFromRole" asp-route-roleId="@Model.Id" class="btn btn-primary">
    从角色移除用户
</a>